// run: $exec < input
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
int gcd(int x, int y)
{
	if(x==0)return y;
	else return gcd(y%x, x);
}
int rec[105];
int main()
{
	std::ios::sync_with_stdio(false);
	int t;
	scanf("%d", &t);
	while(t--)
	{
		int n, m;
		scanf("%d%d", &n, &m);
		memset(rec, 0, sizeof(rec));
		for(int i=1;i<=m;i++){
			int x, y;
			scanf("%d%d", &x, &y);
			rec[x]=y;
		}
		int tmp=0;
		for(int i=n;i>=3;i--){
			if(rec[i]>tmp){
				tmp=rec[i];
			}
			else rec[i]=tmp;
		}
		tmp=0;
		if(!rec[1])rec[1]=100;
		else{
			tmp=rec[1];
		}
		if(!rec[2])
		{
			if(tmp!=0)
				rec[2]=tmp;
			else rec[2]=100;
		}
		int s1=rec[1]+rec[2];
		int s2 = 0;
		for(int i=1;i<=n;i++)s2+=rec[i];
		int ss=gcd(s1, s2);
		s1/=ss;
		s2/=ss;
		printf("%d/%d\n", s1, s2);
	}
}

